home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / amos / guiext162.lha / GuiExtension / Demos / GuiNet.Amos / GuiNet.amosSourceCode < prev   
AMOS Source Code  |  1997-05-04  |  2KB  |  75 lines

  1. '
  2. '                Net Demo v 1.0 - Asynchronous Net Access  
  3. '
  4. ' A nice and simple demo for internet connection with asynchronous   
  5. ' data transfer! This program download the Aminet last 7 days uploads
  6. ' list from the main Aminet site (ftp.wustl.edu) 
  7. '
  8. ' NOTE: the TCP commands are under development! This is only a preview!
  9.  
  10.  
  11. Amos To Back : Extension_24_0018 1,1,20 : Reserve As Work 10,16384 : S=Start(10)
  12. S1=S : S2=S+Length(10)-2048 : E$=Chr$(13)+Chr$(10)
  13.  
  14.  
  15. 'Open the connection and destination file  
  16. '------------------------------------------- 
  17. MSG["Making HTTP connection to ftp.wustl.edu",0]
  18. AMINET= Extension_24_0552(1,"ftp.wustl.edu/80") : DEST= Extension_24_0564(2,"Ram:Recent.html")
  19.  
  20.  
  21. If AMINET
  22.    
  23.    A= Extension_24_05C8(1,"GET /~aminet/recent.html"+E$) : MSG["Done sending HTTP request; Waiting for response.",0]
  24.    A= Extension_24_05DA(1,S,2048) : R=-1 : Add S,2048 : Extension_24_064C 
  25.    
  26.    Repeat 
  27.       
  28.       ACT= Extension_24_0034 
  29.       
  30.       If ACT=-9
  31.          
  32.          If Extension_24_0600 ><-1
  33.             
  34.             If Extension_24_068A =1
  35.                
  36.                A= Extension_24_05DA(1,S,2048) : A= Extension_24_0590(2, Extension_24_069C , Extension_24_0600 )
  37.                T= Extension_24_065C : If R=-1 : MSG["Trasferring data.",0] : End If 
  38.                R= Extension_24_0600 : R1=R1+R : Extension_24_009E 1,1,0,R1
  39.                Trap Extension_24_009E 1,3,0,R1/T : Add S,2048,S1 To S2
  40.                
  41.             End If 
  42.             
  43.          Else 
  44.             
  45.             MSG["Fatal Error. Aborting!",1] : Exit 
  46.             
  47.          End If 
  48.          
  49.       Else If ACT=2
  50.          
  51.          MSG["User Abort.",1] : Exit 
  52.          
  53.       End If 
  54.       
  55.    Until R=0
  56.    
  57. Else 
  58.    
  59.    A= Extension_24_0150("Error!","Unable to open connection!","Ooopsss!")
  60.    
  61. End If 
  62.  
  63. MSG["Done.",0] : Extension_24_0578 
  64.  
  65.  
  66. 'Wait the close event... 
  67. '------------------------
  68. Repeat : Until Extension_24_0034 =-1 : Extension_24_0130 : Extension_24_0090 
  69.  
  70.  
  71. Procedure MSG[A$,B]
  72.    
  73.     Extension_24_009E 1,0,0,Varptr(A$) : If B Then Extension_24_038C 
  74.    
  75. End Proc